#include "common.h"

int res = 0;
int nn;
int flg[16] = { 0 };
void dfs(int index)
{
	if (index > nn)
	{
		res += 1;
		return;
	}
	for (int i = 1; i <= nn; i++)
	{
		if (flg[i] == 0)
		{
			if (i % index == 0 || index % i == 0)
			{
				flg[i] = 1;
				dfs(index + 1);
				flg[i] = 0;
			}
		}
	}
}
int countArrangement(int n)
{
	nn = n;
	dfs(1);
	return res;
}
